import { ILocale } from '@/store/types';
import { TranslateMenu } from '@/hooks/types';
import { useAppSettingStore } from '@/store/module/useAppSettingStore';

export const useTranslate = () => {
  const translateMenu = [
    {
      title: '简体中文',
      type: ILocale.ZH_CN,
    },
    {
      title: 'English',
      type: ILocale.EN,
    },
  ] as TranslateMenu[];

  const appSettingStore = useAppSettingStore();

  const changeTranslate = (command: ILocale) => {
    appSettingStore.setLocale(command);
  };

  return {
    translateMenu,
    changeTranslate,
  };
};
